Skip to content

Conversation

@kakapiciu
Copy link
Member

#212 2.2

@codecov
Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (2eb6e2d) 65.22% compared to head (40524b9) 64.88%.
Report is 27 commits behind head on 4.0.

Files Patch % Lines
src/Admin/src/Entity/EnumAdminStatus.php 0.00% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                4.0     #216      +/-   ##
============================================
- Coverage     65.22%   64.88%   -0.34%     
- Complexity      363      367       +4     
============================================
  Files            49       50       +1     
  Lines          1734     1743       +9     
============================================
  Hits           1131     1131              
- Misses          603      612       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alexmerlin alexmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a mixture of the two solutions (2.1 and 2.2) that I recommended.
The point of 2.2 is to have a single EnumType class that can be reused across all entities.
My recommendations:

  • create a new directory inside src/App/src, call it Doctrine or Types
  • refactor src/Admin/src/Entity/EnumAdminStatus.php by moving it to that new directory and calling it EnumType
  • register EnumType inside config/autoload/doctrine.global.php as before
  • adapt Admin entity by setting the status property's type to EnumType::NAME

Note:
Once you run the migration and the fixture, executing the diff command will throw an error, complaining that in EnumType::getSQLDeclaration the key values does not exist (neither would default, but that's a coincidence that it exists in both the type definition and the database table). This happens because executing the diff command will compare the already existing status column with the definition found in the entity. It is the definition coming from the database that does not have the values key.
You need to dig further in order to find out how to fix this issue.

@kakapiciu kakapiciu closed this Jan 22, 2024
@arhimede
Copy link
Member

Let's keep this open until we decide what to do with it

@arhimede arhimede reopened this Jan 22, 2024
@arhimede arhimede added the wip Work in progress label Feb 12, 2024
@arhimede arhimede marked this pull request as draft May 23, 2024 10:27
@alexmerlin
Copy link
Member

Closing in favor of #300

@alexmerlin alexmerlin closed this Feb 24, 2025
@alexmerlin alexmerlin deleted the issue212 branch February 24, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wip Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants